package com.bw.Controller;

import com.bw.Service.OrderInfoService;
import com.bw.bean.Vo;
import com.bw.bean.Vo2;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @program: monthexam
 * @ClassName OrderInfoController
 * @description:
 * @author: 10994 wzq
 * @create: 2025-06-17
 * @Version 1.0
 **/
@RestController
public class OrderInfoController {
    @Autowired
    OrderInfoService orderInfoService;

    @RequestMapping ("/test1")
    public Map test1(){
        List<Vo> vos = orderInfoService.test1();
        Map lineData = SugarUtil.getLineData(vos);
        return lineData;
    }

    @RequestMapping ("/test2")
    public Map test2(){
        List<Vo2> vo2s = orderInfoService.test2();
        ArrayList<String> list = new ArrayList<>();
        list.add("来源名称");
        list.add("订单总额");
        list.add("下单用户总数");
        list.add("订单总数");
        Map tablePlayData = SugarUtil.getTablePlayData(list, vo2s);
        return tablePlayData;
    }

    @RequestMapping ("/test3")
    public Map test3(){
        double v = orderInfoService.test3();
        Map flipNumberData = SugarUtil.getFlipNumberData(v);
        return flipNumberData;
    }

    @RequestMapping ("/test4")
    public Map test4(){
        List<Vo> vos = orderInfoService.test4();
        ArrayList<String> list = new ArrayList<>();
        list.add("课程名称");
        list.add("订单金额");
        Map tablePlayData = SugarUtil.getTablePlayData(list, vos);
        return tablePlayData;
    }
}
